﻿using System;
using System.Linq;
using System.IO;
using System.IO.IsolatedStorage;
using System.Collections.Generic;
using Microsoft.LightSwitch;
using Microsoft.LightSwitch.Framework.Client;
using Microsoft.LightSwitch.Presentation;
using Microsoft.LightSwitch.Presentation.Extensions;
using LightSwitchApplication.UserCode;
namespace LightSwitchApplication
{
    public partial class RptCashPayRec
    {
        partial void PO_Changed()
        {
            this.RefID = Uti.IsNull(PO) ? "" : PO.DocumentID;
        }

        partial void SO_Changed()
        {
            this.RefID = Uti.IsNull(SO) ? "" : SO.DocumentID;
        }

        partial void Print_Execute()
        {
            // Write your code here.
            if (this.ToDate == null || this.FromDate == null || this.FromDate > this.ToDate)
            {
                this.ShowMessageBox("Vui lòng kiểm tra lại giá trị ngày nhập", "Lỗi", MessageBoxOption.Ok);
                return;
            }

            LightSwitchApplication.UserCode.ReportHelper s = new UserCode.ReportHelper();
            s.ReportTitle = "Báo cáo thu chi";
            s.Parameters.Add("FromDate", this.FromDate);
            s.Parameters.Add("ToDate", this.ToDate);
            s.Parameters.Add("ObjectID", Uti.IsNull(this.ObjectID) ? "" : this.ObjectID.ObjectID);
            s.Parameters.Add("ReasonID", Uti.IsNull(this.ReasonID) ? "" : this.ReasonID.ReasonID);
            s.Parameters.Add("RefID", this.RefID);
            s.Parameters.Add("IsGroupObject", this.IsGroupObject);
            
            s.ShowReport("CashPayRec");
        }

        partial void RptCashPayRec_Created()
        {
            // Write your code here.
            this.FromDate = DateTime.Now;
            this.ToDate = DateTime.Now;
        }
    }
}
